import request from '@/utils/ruizhiRequest'
// 查询日期的基差
export const RetrieveFutureSpotBasic = (date) => {
  return request({
    url: '/v1/admin/dailymaintain/spotBasic/retrieve/',
    method: 'get',
    params: { date },
  })
}
// 修改基差数据
export const UpdateFutureSpotBasic = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/spotBasic/update/',
    method: 'put',
    data,
  })
}
// 保存基差数据
export const CreateFutureSpotBasic = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/spotBasic/create/',
    method: 'post',
    data,
  })
}

// 查询日期的持仓数据
export const RetrieveFuturePosition = (date) => {
  return request({
    url: '/v1/admin/dailymaintain/position/retrieve/',
    method: 'get',
    params: { date },
  })
}
// 修改持仓数据
export const UpdateFuturePosition = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/position/update/',
    method: 'put',
    data,
  })
}
// 保存持仓数据
export const CreateFuturePosition = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/position/create/',
    method: 'post',
    data,
  })
}

// 查询证券行情
export const RetrieveBondCandle = (symbol, page = 1, page_size = 50) => {
  return request({
    url: '/v1/admin/dailymaintain/bondCandle/retrieve/',
    method: 'get',
    params: { symbol, page, page_size },
  })
}
// 获取证券的日k行情
export const GetBondCandleQuote = (symbol, start, end) => {
  return request({
    url: '/v1/admin/dailymaintain/bondCandle/quotes/',
    method: 'get',
    params: { symbol, start, end },
  })
}
// 保存证券的日k行情
export const SaveBondCandleQuote = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/bondCandle/quotes/',
    method: 'post',
    data,
  })
}

// -------------- 定期报告
// 查询定期报告
export const RetrievePeriodReport = (ft, page = 1, page_size = 30) => {
  return request({
    url: '/v1/admin/dailymaintain/periodReport/retrieve/',
    method: 'get',
    params: { ft, page, page_size },
  })
}
// 保存新额定期报告
export const CreatePeriodReport = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/periodReport/create/',
    method: 'post',
    data,
  })
}
// 修改当前定期报告
export const UpdatePeriodReport = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/periodReport/update/',
    method: 'put',
    data,
  })
}

// 上传研究文件
export const UploadResearchFile = (data) => {
  return request({
    url: '/v1/admin/dailymaintain/periodReport/researchFile/upload/',
    method: 'post',
    data,
  })
}

export const RetrieveResearchFile = (ft, page, page_size) => {
  return request({
    url: '/v1/admin/dailymaintain/periodReport/researchFile/retrieve/',
    method: 'get',
    params: { ft, page, page_size },
  })
}
